#ifndef _MARIO_GAME_H_
#define _MARIO_GAME_H_

#include <d3dx9.h>

//#include "Global.h"
#include "Game.h"
#include "Sprite.h"
#include "Mario.h"

#include "Goomba.h"

#include "Audio.h"
#include "Sample.h"
#include "Camera.h"
#include "CMap.h"

#include "QuadTree.h"
#include "LoadMap.h"
#include "Info.h"
#include "Score.h"
#include "dxaudio.h" 

class Mario;
/**--------------------------------------------------------
*Program/Project : GameMario
*Written by : 
*Email :
*Created date : 7/10/2012
*Modified by :
*Modified date :
*Version : 1.0
*Description : Lop khoi tao MarioManager
--------------------------------------------------------**/


class MarioGame: public Game
{
public:
	LPD3DXSPRITE _spriteHandler;	// SpriteHandler to draw texture


	MarioGame(HINSTANCE hInstance, LPWSTR Name, int Mode, int IsFullScreen, int FrameRate);
	~MarioGame();
	 
	
//protected:

	int num_Score;					//score game
	int num_Life;					//number life of mario
	int num_Coin;					//number coin of mario
	int count_Time;					//time to complete level
	int reset_Time;
	int game_State;					//trang thai game
	int map_Current;				//map chinh dang choi
	int submap;						//map phu
	int subMapToMap;				//kiem tra co chuyen tu map phu sang map chinh k
	bool isReplay;					//kiem tra game co dc choi lai k

	int yPointMenu;					//con tro menu
	int xPointMenu;

	int timeChangeMap;
	Sprite* pointMenu;				//con tro menu	

	int isLoadGame;					//kiem tra load game dau tien hay choi roi moi load game?
	
	Mario* _mario;
	
	
	Camera *camera;
	
	vector<Object*> map_list;
	

	LoadMap *load_QTree;
	QuadTree *quadtree;
	list<Object*> obj_list;
	list<Object*> obj_list_save;

	Audio* audio;
	Sample* wobble;

	/*
	 *	Hien thi Diem, Mang,..
	 */
	Info* infoArr[9];
	Score* scoreArr[6];
	list<Score*> scoreList;
	list<Score*> scoreRemoveList;

	/*
	 *	Am thanh
	 */
	DxAudio *dxAudio;
	CSound *backgroundSound, *bonusRiseSound, *brickBreakSound, *bumpSound, *coinSound, *deathSound, *fireballSound, *gameOverSound;
	CSound *jumpSound, *kickSound, *lifeSound, *mipSound, *pipeWarpSound, *powerupSound, *startGameSound, *winGameSound;


	virtual void RenderFrame(LPDIRECT3DDEVICE9 d3ddv, LPDIRECT3DSURFACE9 BackBuffer, int Delta);
	virtual void ProcessInput(LPDIRECT3DDEVICE9 d3ddv, int Delta);
	virtual void LoadResources(LPDIRECT3DDEVICE9 d3ddv, LPDIRECT3DSURFACE9 BackBuffer);	

	virtual void update(LPDIRECT3DDEVICE9 d3ddv, LPDIRECT3DSURFACE9 BackBuffer, int Delta);

	void InfoScore(int score, int x, int y);
	void ChangeState(int state);
	void ChangeMap(int map);
	void ChangeSubMap(int submap);
};


#endif